home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / CheatPopUp.as < prev    next >
Encoding:
Text File  |  2013-04-24  |  2.7 KB  |  72 lines

  1. class CheatPopUp extends PopUp
  2. {
  3.    var sState;
  4.    var nCount;
  5.    var mcRef;
  6.    static var nMAX_LENGTH_CODE = 22;
  7.    static var sCODE_CHARS_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 _!?.";
  8.    static var sSTATE_CHEAT_OUTFITS = "Outfits";
  9.    static var sSTATE_CHEAT_BADCODE = "BadCode";
  10.    static var sSTATE_CHEAT_EMPTY = "Empty";
  11.    function CheatPopUp(_mcRef)
  12.    {
  13.       super(_mcRef);
  14.    }
  15.    function doShow()
  16.    {
  17.       if(this.sState == PopUp.sSTATE_IDLE)
  18.       {
  19.          this.setState(PopUp.sSTATE_OPENING);
  20.          this.nCount = 0;
  21.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_EMPTY);
  22.       }
  23.    }
  24.    function doHide()
  25.    {
  26.       if(this.sState == PopUp.sSTATE_OPENED)
  27.       {
  28.          var _loc2_ = this.mcRef.mcState.mcPanel.mcResult._currentframe;
  29.          var _loc3_ = this.mcRef.mcState.mcPanel.txtCheat.text;
  30.          this.setState(PopUp.sSTATE_CLOSING);
  31.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(_loc2_);
  32.          this.mcRef.mcState.mcPanel.txtCheat.text = _loc3_;
  33.       }
  34.    }
  35.    function clickCancelButton()
  36.    {
  37.       Controller.getRef().playClickSound();
  38.       this.doHide();
  39.    }
  40.    function clickEnterButton()
  41.    {
  42.       Controller.getRef().playClickSound();
  43.       if(this.mcRef.mcState.mcPanel.txtCheat.text == LD.sCHEAT_CLOTHING)
  44.       {
  45.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_OUTFITS);
  46.          Main.getRef().setCheatClothes(true);
  47.       }
  48.       else
  49.       {
  50.          this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_BADCODE);
  51.       }
  52.       Selection.setFocus(this.mcRef.mcState.mcPanel.txtCheat);
  53.    }
  54.    function manageChange()
  55.    {
  56.       this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_EMPTY);
  57.    }
  58.    function initPopUp()
  59.    {
  60.       this.mcRef.mcState.mcPanel.btnCancel.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  61.       this.mcRef.mcState.mcPanel.btnCancel.onRelease = Delegate.create(this,this.clickCancelButton);
  62.       this.mcRef.mcState.mcPanel.btnEnter.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  63.       this.mcRef.mcState.mcPanel.btnEnter.onRelease = Delegate.create(this,this.clickEnterButton);
  64.       this.mcRef.mcState.mcPanel.txtCheat.tabIndex = 101;
  65.       this.mcRef.mcState.mcPanel.txtCheat.maxChars = CheatPopUp.nMAX_LENGTH_CODE;
  66.       this.mcRef.mcState.mcPanel.txtCheat.restrict = CheatPopUp.sCODE_CHARS_ALLOWED;
  67.       this.mcRef.mcState.mcPanel.txtCheat.onChanged = Delegate.create(this,this.manageChange);
  68.       Selection.setFocus(this.mcRef.mcState.mcPanel.txtCheat);
  69.       this.mcRef.mcState.mcPanel.mcResult.gotoAndStop(CheatPopUp.sSTATE_CHEAT_EMPTY);
  70.    }
  71. }
  72.